<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>当前城市天气预报</title>
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath }/css/table.css"/>
    <style>
        /* 全局样式 */
        body {
            font-family: 'Roboto', sans-serif;
            margin: 0;
            padding: 0;
            color: #333;
            height: 100vh;
            display: flex;
            justify-content: center;
            align-items: center;
        }

        .weather-container {
            max-width: 800px;
            background-color: rgba(255, 255, 255, 0.9);
            padding: 30px;
            border-radius: 15px;
            box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
            text-align: center;
            position: relative;
            overflow: hidden;
        }

        h1 {
            font-size: 28px;
            color: #0073e6;
            margin-bottom: 20px;
            text-transform: uppercase;
            letter-spacing: 1px;
        }

        .weather-container::before,
        .weather-container::after {
            content: '';
            position: absolute;
            width: 200px;
            height: 200px;
            border-radius: 50%;
            z-index: 1;
        }

        .weather-container::before {
            top: -50px;
            left: -50px;
            background: rgba(0, 115, 230, 0.3);
        }

        .weather-container::after {
            bottom: -50px;
            right: -50px;
            background: rgba(135, 206, 235, 0.3);
        }

        .weather-details {
            position: relative;
            z-index: 2;
            display: flex;
            justify-content: space-between;
            margin-top: 20px;
        }

        .weather-detail {
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            width: 120px;
            padding: 15px;
            background-color: rgba(0, 115, 230, 0.1);
            border-radius: 8px;
        }

        .weather-detail span:first-child {
            font-weight: bold;
            color: #0073e6;
            margin-bottom: 8px;
        }

        .city-name {
            font-size: 26px;
            color: #0073e6;
            margin-bottom: 10px;
            font-weight: bold;
        }

        .weather-icon {
            font-size: 64px;
            margin: 20px 0;
        }

        .refresh-btn {
            padding: 12px 25px;
            background-color: #0073e6;
            color: #fff;
            border: none;
            border-radius: 25px;
            cursor: pointer;
            font-size: 16px;
            text-transform: uppercase;
            letter-spacing: 1px;
            transition: background-color 0.3s;
            margin-top: 20px;
            z-index: 2;
        }

        .refresh-btn:hover {
            background-color: #005bb5;
        }
    </style>
</head>
<body>

<div class="weather-container">
    <h1>天气预报</h1>

    <div class="city-name">
        ${weather['城市']}
    </div>

    <!-- 天气图标 -->
    <div class="weather-icon">
        <!-- 根据天气动态展示不同的天气图标 -->
        <c:choose>
            <c:when test="${weather.天气 eq '晴'}">
                ☀️
            </c:when>
            <c:when test="${weather.天气 eq '雨'}">
                🌧️
            </c:when>
            <c:when test="${weather.天气 eq '阴'}">
                ☁️
            </c:when>
            <c:otherwise>
                🌤️
            </c:otherwise>
        </c:choose>
    </div>


    <div class="weather-details">
        <div class="weather-detail">
            <span>日期</span>
            <span>${weather['日期']}</span>
        </div>
        <div class="weather-detail">
            <span>天气</span>
            <span>${weather['天气']}</span>
        </div>
        <div class="weather-detail">
            <span>温度</span>
            <span>${weather['温度']} °C</span>
        </div>
        <div class="weather-detail">
            <span>湿度</span>
            <span>${weather['湿度']} %</span>
        </div>
        <div class="weather-detail">
            <span>风速</span>
            <span>${weather['风力']}</span>
        </div>
        <div class="weather-detail">
            <span>空气质量</span>
            <span>${weather['空气质量']}</span>
        </div>
    </div>

    <form action="weather" method="GET">
        <button type="submit" class="refresh-btn">刷新天气</button>
    </form>

</div>
</body>
</html>
